﻿<?php
date_default_timezone_set('Asia/Shanghai');
header("Content-type:text/html;charset=utf-8");
include_once('Model.class.php');
$model = M('game');
$model2 = M('game_id');
$model3 = M();


$str ="sessionid='".$_POST['sessionid']."'";
$affcount = $model2->where($str)->find();

if($affcount.count()){

//    $data= $model->where($str)->order('score desc, time')->select();
    $data= $model->where($str)->order('score desc, (time+0) asc')->select();
//    $data= $model3->query($sql);

    echo '{"status": 1, "data": '.urldecode(json_encode($data)).'}';
}else {
        echo '{"status": 0}';
}